// 封装页面跳转

// 打开页面动画
const Animation_Type_In = 'slide-in-right'
// 返回页面动画
const Animation_Type_Out = 'slide-out-right'

// 切换动画时间
const Animation_Duration = 300

// 重加载：页面全部出栈，只留下新的页面
export function reLaunchSelf(url,success,fail,complete){
	uni.reLaunch({
		url,
		success,
		fail,
		complete
	})
}

// 页面返回	:页面不断出栈，直到目标返回页	
export function navigateBackSelf(delta=1 ,success,fail,complete){
	uni.navigateBack({
		delta,
		animationType:Animation_Type_Out,
		animationDuration:Animation_Duration,
		success,
		fail,
		complete
	})
}

// 页面重定向:当前页面出栈，新页面入栈
function redirectToSelf(){
	
}

// 打开新页面：新页面入栈	
export function navigateToSelf(url,events,success,fail,complete){
	uni.navigateTo({
		url,
		events,
		success,
		complete,
		fail,
		animationDuration:Animation_Type_In,
		animationDuration:Animation_Duration
	})
}

// Tab 切换：页面全部出栈，只留下新的 Tab 页面		
export function switchTabSelf(url,success,fail,complete){
	uni.switchTab({
		url,
		success,
		fail,
		complete
	})
}

